package com.sskj.api.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {

    @Bean
    public OpenAPI iotOpenAPI() {
        return new OpenAPI()
                .info(new Info().title("物联网平台API文档")
                        .version("1.0.0")
                        .description("湖北三思科技股份有限公司")
                        .contact(new Contact().name("技术研发部").email("tech@sskj.com").url("http://tech.sskj.com"))
                        .license(new License().name("Apache 2.0").url("https://springdoc.org")))
                .externalDocs(new ExternalDocumentation().description("项目 Wiki")
                        .url("https://wiki.example.com"));
    }

    @Bean
    public GroupedOpenApi adminApi() {
        return GroupedOpenApi.builder()
                .group("后台管理接口")
                .pathsToMatch("/admin/**")
                .packagesToScan("com.sskj.api.controller.admin")
                .build();
    }
}
